class Node:
    def __init__(self, value):
        self.value = value
        self.next = None


class LinkedList:
    def __init__(self, head):
        self.head = head
        self.size = 1

    def add(self, value):
        # 添加元素到头部
        new_node = Node(value)
        new_node.next = self.head
        self.head = new_node
        self.size += 1

    def print_link(self):
        print('head node:', self.head.value)
        cur_node = self.head
        print(cur_node.next)
        while cur_node is not None:
            print(cur_node.value)
            cur_node = cur_node.next


if __name__ == '__main__':
    head = Node(1)
    link = LinkedList(head)

    link.add(2)
    link.add(3)
    link.add(4)
    link.print_link()
